package com.itheima.socket.sendUDP;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Client {
    public static void main(String[] args) throws Exception {
        // 创建发送者
        DatagramSocket socket = new DatagramSocket(6666);

        // 创建要发送的数据
        byte[] bytes = "啊啊啊啊啊啊啊".getBytes();
        DatagramPacket packet = new DatagramPacket(
                bytes,
                bytes.length,
                InetAddress.getLocalHost(),
                6666
        );

        // 开始发数据
        socket.send(packet);
        System.out.println("客户端发送完毕！！！");
        socket.close();
    }
}
